//
//  TestClass.m
//  RuntimeLearn
//
//  Created by 木槿科技 on 2018/4/4.
//  Copyright © 2018年 深圳市木槿科技有限公司. All rights reserved.
//

#import "TestClass.h"
#import <objc/runtime.h>
@implementation TestClass

+ (BOOL)resolveInstanceMethod:(SEL)sel {
    Method exchangeM = class_getInstanceMethod([self class], @selector(eatWithPersonName:));
    //拿到IMP指针
    class_addMethod([self class], sel, class_getMethodImplementation(self, @selector(eatWithPersonName:)),method_getTypeEncoding(exchangeM));
    return YES;
}
- (void)eatWithPersonName:(NSString *)name {
    NSLog(@"Person %@ start eat ",name);
}
@end
